package com.aiyige.model.eshop;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * Created by zhuyakun on 2018/1/29.
 */

public class SellerBackup implements Parcelable {
    String id;
    String name;
    String avatar;
    Integer level;
    String tel;
    String accid;

    protected SellerBackup(Parcel in) {
        id = in.readString();
        name = in.readString();
        avatar = in.readString();
        if (in.readByte() == 0) {
            level = null;
        } else {
            level = in.readInt();
        }
        tel = in.readString();
    }

    public SellerBackup() {
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeString(name);
        dest.writeString(avatar);
        if (level == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(level);
        }
        dest.writeString(tel);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<SellerBackup> CREATOR = new Creator<SellerBackup>() {
        @Override
        public SellerBackup createFromParcel(Parcel in) {
            return new SellerBackup(in);
        }

        @Override
        public SellerBackup[] newArray(int size) {
            return new SellerBackup[size];
        }
    };

    public String getId() {
        return id == null ? "":id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name == null ? "":name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return avatar == null ? "":avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Integer getLevel() {
        return level == null ? 0:level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getTel() {
        return TextUtils.isEmpty(tel) ? "":tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getAccid() {
        return accid == null ? "" : accid;
    }

    public void setAccid(String accid) {
        this.accid = accid == null ? "" : accid;
    }
}
